/********************************************************
* @file: WINZOOM.h
* @date: 16/12/2010
********************************************************
* acmFrame
********************************************************/


#ifndef _WINZOOM_H_
#define _WINZOOM_H_

#include "./draw.h"


// macro to call the singleton mgControl
//---------------------------------------
#define ZOOM WINZOOM::instance()


/*!
* CLASS
* WINZOOM
*
* Collector of geometric objects. 
*
* @version 5.00 $Date: 15/02/2000 $
*/
class WINZOOM
{

public:

  // @brief accesses the singleton object.
  static WINZOOM& instance();


protected:

  // @brief default constructor.
  WINZOOM();

  // @brief destructor.
  virtual ~WINZOOM();


public:

  void setEndAction (void *obj, void (*endAction)(void *obj, double xmin, double ymin, double xmax, double ymax, int old_state));
  void setDraw       (drawGRA *_obj);
  void setCurrState (int state) { m_oldState = state;} 

  int begin        (int curr_state);
  int addPoint     (double _x, double _y);
  int addTempPoint (double _x, double _y);

  void draw();

  bool isActive()
  {
    return m_active;
  }
  void active()
  {
    m_active = true;
  }
  void desactive()
  {
    m_active = false;
  }

private:
  // pointer to the SINGLETON object of this class.
  static WINZOOM* m_zoom;
  bool m_active;
  
  // insert first point?
  bool m_firstPts;
  
  // old state;
  int m_oldState;

  drawGRA     *m_objdraw;
  void        *m_objClass;

  // current temporary pts
  double      xtmp, ytmp;
  
  // current points
  double  m_x1, m_y1, m_x2, m_y2;

  void       (*m_endAction) (void *m_objClass, double xmin, double ymin, double xmax, double ymax, int old_state);

};

#endif // _ZOOM_H_
